const mysql = require('mysql');
const co = require('co-mysql');


// 获取配置信息, 得到需要的信息
let {
    DB_HOST,
    DB_USER,
    DB_PASS,
    DB_NAME
} = require('../config')

let conn = mysql.createPool({
    host: DB_HOST,
    user: DB_USER,
    pass: DB_PASS,
    database: DB_NAME
})

// 导出数据库对象
module.exports = co(conn);